//package com.coocare.licence.config.oss;
//
//import com.amazonaws.services.s3.model.S3Object;
//import com.amazonaws.services.s3.model.S3ObjectSummary;
//import lombok.AllArgsConstructor;
//import lombok.Cleanup;
//import lombok.SneakyThrows;
//import org.springframework.http.HttpStatus;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.web.multipart.MultipartFile;
//
//import java.io.InputStream;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * aws 对外提供服务端点
// *
// * @author housekeeper
// * @author 858695266
// * <p>
// * oss.info
// */
//@RestController
//@AllArgsConstructor
//@RequestMapping("/oss")
//public class OssEndpoint {
//
//	private final OssTemplate template;
//
//
//	/**
//	 * Object Endpoints
//	 */
//	@SneakyThrows
//	@PostMapping("/object/{bucketName}")
//	public S3Object createObject(@RequestBody MultipartFile object, @PathVariable String bucketName) {
//		String name = object.getOriginalFilename();
//		@Cleanup
//		InputStream inputStream = object.getInputStream();
//		template.putObject(bucketName, name, inputStream, object.getSize(), object.getContentType());
//		return template.getObjectInfo(bucketName, name);
//
//	}
//
//	@SneakyThrows
//	@PostMapping("/object/{bucketName}/{objectName}")
//	public S3Object createObject(@RequestBody MultipartFile object, @PathVariable String bucketName,
//			@PathVariable String objectName) {
//		@Cleanup
//		InputStream inputStream = object.getInputStream();
//		template.putObject(bucketName, objectName, inputStream, object.getSize(), object.getContentType());
//		return template.getObjectInfo(bucketName, objectName);
//
//	}
//
//	@SneakyThrows
//	@GetMapping("/object/{bucketName}")
//	public List<S3ObjectSummary> filterObject(@PathVariable String bucketName, @RequestParam String objectName) {
//		return template.getAllObjectsByPrefix(bucketName, objectName, true);
//	}
//
//	@SneakyThrows
//	@GetMapping("/object/{bucketName}/{expires}")
//	public Map<String, Object> getObject(@PathVariable String bucketName, @RequestParam String objectName,
//			@PathVariable Integer expires) {
//		Map<String, Object> responseBody = new HashMap<>(8);
//		// Put Object info
//		responseBody.put("bucket", bucketName);
//		responseBody.put("object", objectName);
//		responseBody.put("url", template.getObjectURL(bucketName, objectName, expires));
//		responseBody.put("expires", expires);
//		return responseBody;
//	}
//
//	@SneakyThrows
//	@ResponseStatus(HttpStatus.ACCEPTED)
//	@DeleteMapping("/object/{bucketName}")
//	public void deleteObject(@PathVariable String bucketName, @RequestParam String objectName) {
//		template.removeObject(bucketName, objectName);
//	}
//
//	@SneakyThrows
//	@GetMapping("/preUpload/{bucketName}")
//	public String preUpload(@PathVariable String bucketName, @RequestParam String objectName) {
//		return template.preUploadUrl(bucketName, objectName);
//	}
//
//}
